<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
	</head>
	<body>
		<div id="app">
			<button-counter></button-counter>
		</div>
		<script src="vue.js"></script>
		<script src="https://unpkg.com/vuex@3.1.1/dist/vuex.js"></script>
		<script>
			
			const store = new Vuex.Store({
			  state: {
			    count: 0
			  },
			  mutations: {
			    increment (state) {
			      state.count++
			    }
			  }
			})
			
			Vue.component('ButtonCounter', {
				computed: {
					count(){
						return this.$store.state.count;
					}
				},
				methods: {
					handleClick(){
						//this.$store.commit('increment');
						this.increment();
					},
					...Vuex.mapMutations([
						'increment',
						
					]),
					...Vuex.mapMutations({
						add: 'increment'
					})
				},
				/*methods: Vuex.mapMutations([
					'increment',
				]),
				*/
	      template: '<button @click="increment">You clicked me {{ count }} times.</button>'
  		});
  		
  		new Vue({
			  el: '#app',
			  store,
			})
		</script>
	</body>
</html>